#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n = 0;
    int count = 0;
    scanf("%d", &n);
    for (int i = 0; i <= n; i++)
    {
        int sqrt = i * i;
        int j = i;
        int weisu = 0;
        while (j)
        {
            j = j / 10;
            weisu++;
        }
        int st = 1;
        while (weisu--)
        {
            st = st * 10;
        }
        if (sqrt == 0 || sqrt % st == i)
        {
            count++;
        }

    }
    printf("%d", count);
    return 0;
}